import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router";
import { useMainStore } from "../store/index.ts"
// let mainStore: any = useMainStore()  // 获取pina

const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    name: "screen",
    alias: ["/screen", "/screen2"], // 别名，可以定义很多个
    meta: {
      isShow: true,
    },
    component: () => import("../views/screen/screen.vue"),

    children: [],
  },
  // {
  //   path: "/",
  //   name: "login",
  //   alias: ["/login", "/login2"], // 别名，可以定义很多个
  //   meta: {
  //     isShow: true,
  //   },
  //   component: () => import("../views/login/login.vue"),

  //   children: [],
  // },
  // {
  //   path: "/home",
  //   name: "home",
  //   alias: ["/home", "/home2"], // 别名，可以定义很多个
  //   meta: {
  //     isShow: true,
  //   },
  //   component: () => import("../views/home/home.vue"),

  //   children: [],
  // },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});

/**
 * 路由守卫
 */
// router.beforeEach((to, from, next) => {
//   let mainStore: any = useMainStore()  // 获取pina

//   // console.log('adsa', to, from)
//   // console.log('mains', mainStore.UserPassword, mainStore.handeRouter)
//   if (to.path == '/home' && mainStore.handeRouter) {
//     next()
//   }
//   if (to.path == '/') {
//     next()
//   }

// })

export default router;
